package io.renren.modules.shipping.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.shipping.entity.V9ShippingEntity;
import io.renren.modules.shipping.service.V9ShippingService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-09-19 15:10:49
 */
@RestController
@RequestMapping("shipping/v9shipping")
public class V9ShippingController {
    @Autowired
    private V9ShippingService v9ShippingService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("shipping:v9shipping:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = v9ShippingService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{shippingId}")
    @RequiresPermissions("shipping:v9shipping:info")
    public R info(@PathVariable("shippingId") Integer shippingId){
		V9ShippingEntity v9Shipping = v9ShippingService.getById(shippingId);

        return R.ok().put("v9Shipping", v9Shipping);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("shipping:v9shipping:save")
    public R save(@RequestBody V9ShippingEntity v9Shipping){
		v9ShippingService.save(v9Shipping);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("shipping:v9shipping:update")
    public R update(@RequestBody V9ShippingEntity v9Shipping){
		v9ShippingService.updateById(v9Shipping);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("shipping:v9shipping:delete")
    public R delete(@RequestBody Integer[] shippingIds){
		v9ShippingService.removeByIds(Arrays.asList(shippingIds));
        return R.ok();
    }
    /**
     * 修改
     */
    @RequestMapping("/setorder")
    public R setorder(@RequestParam Map<String, Object> params){
    	v9ShippingService.updateListorder(params);
        return R.ok();
    }

    /**
     * 根据快递名称查询
     */
    @RequestMapping("/queryPage")
    public R queryPage(@RequestParam Map<String, Object> params){
        v9ShippingService.queryPage(params);
        return R.ok();
    }




}